#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <poll.h>

int fd_light = 0;

short light_value;  

int main(void)
{
	int ret;
	
	fd_light = open("/dev/light_drv", O_RDWR);
	if(fd_light < 0)
	{
		perror("open light_drv driver");
		return -1;		
	}
	while(1)
	{
		ret = read(fd_light,&light_value,2);
		if(ret<0)
		{
			perror("read error\n");
			return -1;
		}
		printf("light_value = %d \n",light_value);	
		sleep(1);
	}
	close(fd_light);
	
	return 0;
}